//
//  TKYProcessController.m
//  StationHouseHelper
//
//  Created by apple on 2018/6/26.
//  Copyright © 2018年 铁科院. All rights reserved.
//

#import "TKYProcessController.h"
#import "TKYTProcessCell.h"

#define KProcessCellID  @"TKYTProcessCell"
@interface TKYProcessController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong)BaseTabelView *tabelView;

@end

@implementation TKYProcessController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.tabelView];
    
    [self requestkQuestionFlowListByProjectIdAndUserUrl];
    //Do any additional setup after loading the view from its nib.
}

//根据站房Id及用户Id获取问题流程列表
- (void)requestkQuestionFlowListByProjectIdAndUserUrl{
    NSString *url = [NSString stringWithFormat:@"%@%@projectId=%@&userId=%@&token=%@",kApiBaseUrl,kGetQuestionFlowListByProjectIdAndUserUrl,[[NSUserDefaults standardUserDefaults]objectForKey:KStationHouseID],[[NSUserDefaults standardUserDefaults]objectForKey:kUserID],[[NSUserDefaults standardUserDefaults]objectForKey:kToken]];
    [KHttpRequestTool GET:url parameters:nil success:^(id response) {
        
    } failure:^(NSError *error) {
        
        
    }];
}

#pragma mark-- UITableViewDelegate,UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TKYTProcessCell *cell = [tableView dequeueReusableCellWithIdentifier:KProcessCellID];
    
    if (indexPath.row == 0) {
        cell.pointImageV.image = [UIImage imageNamed:@"time_btn"];
        [cell.topLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            // 这里通过mas_equalTo给size设置了基础数据类型的参数，参数为CGSize的结构体
            make.size.mas_equalTo(CGSizeMake(0, 0));
        }];
        cell.personLabel.text = @"责任人:张某完成";
    }else if (indexPath.row == 1) {
        [cell.showImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            // 这里通过mas_equalTo给size设置了基础数据类型的参数，参数为CGSize的结构体
            make.size.mas_equalTo(CGSizeMake(0, 0));
        }];
        cell.photoOrVideoView.hidden = YES;
        cell.personLabel.text = @"验收人:周某驳回";
        cell.describeLabel.text = @"不同意";
    }else if (indexPath.row == 2){
       
        cell.personLabel.text = @"责任人:张某完成";
         cell.describeLabel.text = @"已按要求完成";
    }else{
        [cell.showImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            // 这里通过mas_equalTo给size设置了基础数据类型的参数，参数为CGSize的结构体
            make.size.mas_equalTo(CGSizeMake(0, 0));
        }];
        
        [cell.describeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(0, 0));
        }];
        
        cell.lineView.hidden = YES;
        cell.photoOrVideoView.hidden = YES;
        cell.personLabel.text = @"发起人:周某发起事件";

    }
    return cell;
}
- (BaseTabelView *)tabelView{
    if (_tabelView == nil) {
        _tabelView = [[BaseTabelView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStylePlain];
        _tabelView.delegate = self;
        _tabelView.dataSource = self;
        _tabelView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tabelView.estimatedRowHeight = 500;  //  随便设个不那么离谱的值
        _tabelView.rowHeight = UITableViewAutomaticDimension;
        [_tabelView registerClass:[TKYTProcessCell class] forCellReuseIdentifier:KProcessCellID];
    }
    return _tabelView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
